package com.example.app.service.impl;

import com.example.app.dao.MemberDiscountRepository;
import com.example.app.model.MemberDiscount;
import com.example.app.service.MemberDiscountService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 * Created by wangtao on 2018/6/6.
 */
@Service
public class MemberDiscountServiceImpl implements MemberDiscountService {

    private static final Logger logger = Logger.getLogger(MemberDiscountServiceImpl.class);

    @PersistenceContext
    EntityManager em;

    @Autowired
    private MemberDiscountRepository memberDiscountRepository;

    @Override
    public MemberDiscount findMemberDiscount(Long memberId) {
        return memberDiscountRepository.findByMemberIdAndDeleteFlag(memberId, 0);
    }
}
